package model;

import java.util.ArrayList;
import java.util.List;

import common.DataManager;
import common.GridCoordinate;



/**
 * @author Colin
 *
 *The small turret is the basic automatic weapon.
 *It has a cost of 100, a square range 3x3, a rate of 2,
 *damage of 1 and speed of 1.
 */
public class SmallTurret extends AutomaticWeapon{
	private static final int DEFAULT_COST = 100;
	private static final int DEFAULT_RANGE_INT = 1;
	private static final int DEFAULT_RATE = 2;
	private static final int DEFAULT_DAMAGE = 3;
	private static final int DEFAULT_SPEED = 8;
	
	//SmallTurret without position
	public SmallTurret(){
		super( "Small Turret", DataManager.SMALL_TURRET, DataManager.SMALL_TURRET_AMMO, DEFAULT_COST, DEFAULT_DAMAGE, DEFAULT_SPEED, DEFAULT_RANGE_INT, DEFAULT_RATE );
	}
	
	//SmallTurret with position
	public SmallTurret( GridCoordinate position){
		super( "Small Turret", DataManager.SMALL_TURRET, DataManager.SMALL_TURRET_AMMO, DEFAULT_COST, position, DEFAULT_DAMAGE, DEFAULT_SPEED, DEFAULT_RANGE_INT, DEFAULT_RATE );
		
		createRange();
	}

	@Override
	public void rotateCCW() {
		//Square range so it stays the same
		
	}

	@Override
	public void createRange() {
		List<GridCoordinate> range = new ArrayList<GridCoordinate>();
		//Sets square range of 3x3
		for( int i = -1*getRangeInt(); i <= getRangeInt(); ++i ){
			for( int j = -1*getRangeInt(); j <= getRangeInt(); ++j ){
				range.add( new GridCoordinate( getPosition().getX() + i, getPosition().getY() + j));
			}
		}
		setRange( range );
		
	}

	@Override
	public String getDescription() {
		return "The Small Turret fires on all zombosaurs within a one tile radius and deals a small amount of damage.";
	}
	
}
